package my.app1.controller

import io.micronaut.http.MediaType
import io.micronaut.http.annotation.Controller
import io.micronaut.http.annotation.Get
import my.app1.client.HelloClient
import my.app1.domain.SomeTest
import my.app1.service.HelloService

import javax.inject.Inject

@Controller("/hello")
class HelloController {

    @Inject
    HelloService helloService

    @Inject
    HelloClient helloClient

    @Get(uri="/add", produces="text/plain")
    String add() {
        helloService.addSomeTest()
        return "ok "+helloClient.hello()
    }

    @Get(uri="/all", produces= MediaType.APPLICATION_JSON)
    List<SomeTest> all() {
        return helloService.findAllSomeTest()
    }

}
